#!/usr/bin/env python
import os,sys,re
from wwpy.db.DBI import DBI,DBC
import web

urls = (
    #'/(.*)',
    '/tms', 'dbt'
)
temp_dir=os.getenv('PY_HOME')+os.sep+'wwpy'+os.sep+'tms'+os.sep+'templates'+os.sep
render=web.template.render(temp_dir)

class dbt:
    def GET(self):
        sql="SELECT groupbuy_id,item_name FROM item_attr limit 10"
        dbi=DBI(coding='utf8',**DBC().db_gb_stat)
        rows=dbi.fetch(sql,has_fields=True)
        return render.tms(rows)
        
    
if __name__ == "__main__":
    app=web.application(urls, globals())
    app.run()
    